﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace M_Manufacture.Repository
{
    public interface IRepository<T> where T : class
    {
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> AddAsync(T entity);
        /// <summary>
        /// 添加返回ID
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> AddAsyncs(T entity);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> UpdateAsync(T entity);
        /// <summary>
        /// 批量修改
        /// </summary>
        /// <param name="entities"></param>
        /// <returns></returns>
        Task<int> UpdateRange(List<T> entities);

        /// <summary>
        /// 反填
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<T> GetModelsAsync(int id);

        /// <summary>
        /// 显示全部
        /// </summary>
        /// <returns></returns>
        Task<List<T>> GetAllAsync();
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="expre"></param>
        /// <returns></returns>
        Task<List<T>> GetAsync(Expression<Func<T, bool>> expre);

    }
}
